<?php

namespace App\Repositories;

use App\Models\ReviewModel;

class ReviewRepository extends BaseRepository
{
    /**
     * @param $params
     * @return array[]
     */
    public function getFilter ($params) {
        $where = [];
        $whereBetween = [];
        return [
            'where' => $where,
            'whereBetween' => $whereBetween
        ];
    }

    /**
     * @param $params
     * @return array
     */
    public function getList ($params)
    {
        $filter = $this->getFilter($params);
        $list = $this->getListItems(ReviewModel::query(), $filter, $params['page_size'] ?? 20, ['*'], 'page', [
            'acc_number' => 'desc',
            'id' => 'desc'
        ]);
        return $list;
    }

    /**
     * @param $params
     * @return mixed
     */
    public function save ($params)
    {
        return @$this->saveOrUpdate('ReviewModel', $params);
    }

}
